package cn.wzg.ZKService.LoadBalanceimpl;

import cn.wzg.ZKService.LoadBalance;

import java.net.InetSocketAddress;
import java.util.List;

/**
 * 轮询负载均衡
 */
public class RoundLoadBalance implements LoadBalance {
    private int choose = -1;
    @Override
    public InetSocketAddress balance(List<InetSocketAddress> addressList) {
        choose++;
        choose = choose%addressList.size();
        return addressList.get(choose);
    }
}
